
//
//  NSString+ZTEmail.m
//  ZtEmail
//
//  Created by Zhengtong on 15/11/10.
//  Copyright © 2015年 Zhengtong. All rights reserved.
//

#import "NSString+ZTEmail.h"

@implementation NSString (ZTEmail)

+ (NSString *)rangeAndComponent:(NSString *)string
{
    NSString *str;
    if([string rangeOfString:@"<"].location !=NSNotFound)//_roaldSearchText
    {
       str = [[string componentsSeparatedByString:@"<"] objectAtIndex:0];
    }else{
        str = [[string componentsSeparatedByString:@"@"] objectAtIndex:0];
    }
    return str;
}

+ (NSString *)email:(NSString *)string
{
    NSString *str;
    if([string rangeOfString:@"<"].location !=NSNotFound)//_roaldSearchText
    {
        str = [[string componentsSeparatedByString:@"<"] objectAtIndex:1];
       str =  [[str componentsSeparatedByString:@">"] objectAtIndex:0];
    }
    return str;
}

@end
